package com.tueye.web.controller;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.tueye.base.util.Page;
import com.tueye.entity.Adinfo;
import com.tueye.entity.Adsite;
import com.tueye.entity.user.ParticularUserInfo;
import com.tueye.entity.user.User;

import com.tueye.service.IAdsiteService;
import com.tueye.service.usermanager.IRegisterService;

import com.tueye.utils.DateUtils;
import com.tueye.utils.TuEyeConstant;
import com.tueye.utils.UUIDGenerator;

/**
 * 用户添加控制层操作demo
 * spring mvc 2.5 支持MultiActionController
 * @author hanxiaowei
 *
 */
@SuppressWarnings("unchecked")
@Controller

public class UserInfoController extends BaseController {
	private Log log = LogFactory.getLog(UserInfoController.class);
	
	@Autowired
	@Qualifier("registerService")
	private IRegisterService registerService;
	
	@RequestMapping("/userinfos.do")
	public String userinfos (HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		String id = request.getParameter("id");
		User user =  registerService.getUserById(id);
		List list = registerService.getParticularuserinfo(id);
		ParticularUserInfo pu;
		if(list.size()==0){
			request.setAttribute("user", user);
			return "pages/admin/usermanager/userinfos";
		}else{
			pu = (ParticularUserInfo) list.get(0);
			request.setAttribute("pu", pu);
			request.setAttribute("user", user);
			return "pages/admin/usermanager/userinfos";
		}
		
	}
	

	
}
